What does this context-free grammar generate?
You conjecture that your grammar generates the language $L$ of words having as many $a$s as $b$s. In order to prove your conjecture, you should do two things:


Prove that every word generated by the grammar belongs to $L$.
Prove that every word in $L$ can be generated by the grammar.


In this case, the first part is easy to prove by structural induction. The second part is more difficult, so here is a hint. Given any non-empty $w \in L$, show that it can be decomposed as either $w = xayb$ or $w = xbya$ for some $x,y \in L$. Given this lemma, you can use induction on $|w|$.

Here is a hint for the lemma. Let $d_k(w) = |\{i \in [k] : w_i = a\}| - |\{i \in [k] : w_i = b\}|$, and let $d(w) = d_0(w),d_1(w),\ldots,d_{|w|}(w)$. For example, $d(aabb) = 0,1,2,1,0$ and $d(baba) = 0,-1,0,-1,0$. A prefix $w_1\ldots w_k \in L$ corresponds to a position $k$ such that $d_k(w) = 0$.