Determine if the language of words with same number of 1's and 2's is context-free or not
When it comes up to deciding if a language is context-free or not, I try the following 'roadmap' to come up with an answer.
$1.$ Try to make a CFG for the given language. If we can make a CFG, we have proved that the language is context-free.
$2.$ If step $1$ did not work out, there is a probabilty that the language is not context-free. So try proving that the given language is not context-free by the pumping lemma.
$3.$ If I fail to prove that language is not context-free, I probably failed to make a CFG so I start to make a PDA.
Remark: This is my way to (dis)prove context-free languages, there are many other ways to do this. So don't take this as a general step-by-step plan.
In your example, we need to (dis)prove $$L_2=\{w \in \{0,1,2\}^* : \text{$w$ has the same number of $1$'s and $2$'s}\}$$
So when we think of a CFG, we should consider that whenever we add a $1$, we should also add a $2$ (and vice-versa), as $|1| = |2|$. We also know that the language can be empty and that the number of $0$'s do not matter.
So
$$S \rightarrow \epsilon $$
$$S \rightarrow 0S$$
$$S \rightarrow 1S2S$$
$$S \rightarrow 2S1S$$
As we were able to make a CFG, we can say that the language $L_2$ is a CFL.