Think about how you'd come up with a decomposition for the set of binary strings you want. Intuitively, what you want is some number of zeros, the same number of ones and stick them together. And then you want to repeat that an arbitrary number of times. For convenience, lets define the set:
$$ A = 01 \cup 0011 \cup 000111 \cup ....$$
With respect to the weight function being the length of the string, the generating function for $A$ is:
$$ A(x) = x^2 + x^4 + x^6 + x^8 + ... \ = \frac {x^2} {1-x^2}$$
So this covers one repetition of the pattern you want. You want to allow this to happen an arbitrary number of times. So the set of all strings you're really interested in is this:
$$ S = \epsilon \cup A \cup A^2 \cup A^3 \cup ... $$
where $\epsilon$ is the empty string
Then the generating function for S is simply, (using the product and sum rules):
$$ S(x) = 1 + A(x) + A(x)^2 + A(x)^3 + ... $$ $$ = \frac {1} {1-A(x)}$$ $$ = \frac {1} {1 - \frac {x^2} {1-x^2}} $$
Which simplifies to:
$$ \frac {1 - x^2} {1 - 2x^2} $$
In general, the hardest and most important part is finding a clean decomposition of these strings -- an enumeration of the set you're interesting in counting properties of. It takes some practice, but I hope this outlines the general principle.