Is there something wellknown about which ring can be a cohomology ring of a manifold? More concretely, I would be interested in the following question: does there exists an $m$, s.t. for each $r,s\in\mathbb{N}$ and $\beta_{i,j}^k\in\mathbb{Z}$, there exists a connected compact $m$manifold $M$ s.t. $H^2(M)\simeq \mathbb{Z}^r$, $H^4(M)\simeq \mathbb{Z}^{s}$ and $x_i\smile x_j=\sum \beta_{i,j}^k y_k$ for the cohomology generators? I would be grateful for some reference..

You probably meant $\beta_{ij}^k=\beta_{ji}^k$ (the cupproduct is commutative). With that condition, there is always a simplyconnected compact $7$manifold $M$ whose only nontrivial cohomology groups are $H^0(M)\cong\mathbb{Z}$, $H^2(M)\cong\mathbb{Z}^r$, and $H^4(M)\cong\mathbb{Z}^s$, and such that the cupproduct is as you indicate. The manifold $M$ can be constructed from a CWcomplex $X$ defined as the mapping cone of a certain map $\varphi\colon\vee_s S^3\rightarrow\vee_rS^2$. There is a subpolyhedron $K\subset\mathbb{R}^7$ of the same (even simple) homotopy type of $X$, see http://math.berkeley.edu/~stall/embkloz.pdf. Take $M$ to be the closure of a nice regular neighbourhood of $K\subset\mathbb{R}^7$. This $M$ is a compact simplyconnected $7$manifold (with boundary). The manifold $M$ is (simply) homotopy equivalent to $X$. Let me now indicate how to define $\varphi$ to get the desired cohomology ring, see Baues' book on 4dimensional complexes. Recall that $\pi_3(\vee_rS^2)\cong\Gamma(\mathbb{Z}^r)$. Here $\Gamma$ is Whitehead's functor, defined for any abelian group $A$ by the existence of a universal quadratic map $\gamma\colon A\rightarrow\Gamma(A)$ (not a homomorphism), i.e. a map such that $\gamma(a)=\gamma(a)$ and the cross effect map $A\times A\rightarrow \Gamma(A)\colon (a,b)\mapsto (ab)=\gamma(a+b)\gamma(a)\gamma(b)$ is bilinear. The isomorphism $\pi_3(\vee_rS^2)\cong\Gamma(\mathbb{Z}^r)$ is defined by the map $\mathbb{Z}^r\cong \pi_2(\vee_rS^2)\rightarrow \pi_3(\vee_rS^2)\colon f\mapsto f\eta$ given by precomposition with the Hopf map $\eta\colon S^3\rightarrow S^2$, which is universal with those properties. The group $\Gamma(\mathbb{Z}^r)$ is free abelian of rank $\binom{r+1}{2}$. If $\{e_1,\dots,e_r\}\subset \mathbb{Z}^r$ is a basis, then $\{\gamma(e_1),\dots,\gamma(e_r)\}\cup\{(e_ie_j) \,;\, 1\leq i < j \leq r\}\subset \Gamma(\mathbb{Z}^r)$ is a basis. There is a natural homomorphism $\tau\colon \Gamma(A)\rightarrow A\otimes A$ defined by the quadratic map $A\rightarrow A\otimes A\colon a\mapsto a\otimes a$. If $A=\mathbb{Z}^r$ then $\tau(\gamma(e_i))=e_i\otimes e_i$ and $\tau(e_ie_j)=e_i\otimes e_j+e_j\otimes e_i$. A homotopy class $\varphi\colon\vee_s S^3\rightarrow\vee_rS^2$ is essentially the same as a homomorphism $f=\pi_3(\varphi)\colon \mathbb{Z}^s\rightarrow \Gamma(\mathbb{Z}^r)$. The cohomology of the mapping cone $X$ is obviously $H^0(X)\cong\mathbb{Z}$, $H^2(X)\cong\mathbb{Z}^r$, $H^4(X)\cong\mathbb{Z}^s$, and zero otherwise. The cupproduct $H^2(X)\otimes H^2(X)\rightarrow H^4(X)$ turns out to be the $\mathbb{Z}$linear dual of $\tau f\colon \mathbb{Z}^s\rightarrow \Gamma(\mathbb{Z}^r)\rightarrow \mathbb{Z}^r\otimes \mathbb{Z}^r$. Hence, if $\{e_1,\dots,e_r\}\subset \mathbb{Z}^r$ and $\{\bar e_1,\dots, \bar e_s\}\subset\mathbb{Z}^s$ are the canonical bases, given by the inclusions of the factors of the wedges, it is enough to define $f$, and hence $\varphi$, as $f(\bar e_k)=\sum_{i=1}^r \beta_{ii}^k\gamma(e_i)+\sum_{1\leq i<k \leq r}\beta_{ij}^k(e_ie_j)$. 

