On any one flip, the probability that all three coins come up the same is $\frac{2}{8}=\frac14$ and the probability that they don't is $\frac34$. Hence, the probability that the three coins come up the same for the first time at exactly the $n$-th flip is ${\left(\frac34\right)}^{n-1}\frac14$.
The expectation is therefore given by
$$\sum_{n\geq 1}n{\left(\frac34\right)}^{n-1}\frac14=\frac14\cdot\sum_{n\geq 1}n{\left(\frac34\right)}^{n-1}.$$
Now, consider $f(x)=\sum_{n\geq0}x^n=\frac{1}{1-x}$, $|x|<1$. We have that
$$f'(x)=\sum_{n\geq1}nx^{n-1}=\frac{1}{{(1-x)}^2}.$$
It follows that the expectation equals
$$\frac14\cdot f'\left(\frac34\right)=\frac14\cdot\frac{1}{{\left(\frac14\right)}^2}=\frac14\cdot16=4$$
This was checking the whole thing via definitions. But you could have skipped it all noting that the chance of 'success' at each step is $1/4$, so the expected value, naturally, would be $4$.