Let's take the initial graph $G=(V, E)$ and create a new graph $G'=(V', E')$ where every vertex $x$ is a state representing a pair ($i$, $j$) of vertices of $G$. So basically, for $N$ vertices in $G$, there are $N^2$ vertices in $G'$
In $G'$, there is an edge from $x_1 = (i_1, j_1)$ to $x_2 = (i_2, j_2)$ iif there are both an edge from $i_1$ to $i_2$ and an edge from $j_1$ to $j_2$ in $G$. Thus, a path in $G'$ of length $k$ corresponds to two different paths in $G$ having the same length $k$.
Now, let's resolve the problem, the same color sequence has to be followed by the two paths. So in $G'$, only vertices representing a pair of identical color vertices in $G$ are allowed. By running a BFS/DFS from $(s, s)$ to $(a, b)$ in this new graph, using only the allowed vertices, one can find if there is a solution to the problem.
The time complexity is $O(|E|^2)$ at worst case (all vertices having the same color). But if there are $c$ colors having rather equivalent populations in $G$, it falls to $O(|E|^2/c)$.
Also note, that you do not have to build explicitely $G'$ to explore it !