A context-free grammar for all strings that end in b and have an even number of bs
There is an easy and very natural way how to derive a context-free grammar $G=(V,\Sigma,R,S)$ from a DEA $M=(Q,\Sigma,\delta,q_0,F)$. We set


$V=Q$
$S= q_0$
$R$ consists of the following rules:

for all $X\in Q$ and $a\in \Sigma$ with $Y=\delta(X,a)$ we add the rule $X \to aY$
for all $X\in F$  we add the rule $X \to \varepsilon$
there are no other rules in $R$



It's an easy exercise to show that $L(G)=L(M)$. With this technique you can now build your automaton first (which is an easy two-state example in your case), and then apply this construction.