Let
$$f ( {\bf X} ) := {\bf a}^{\top} {\bf X} \, {\bf b} = \mbox{tr} \left( {\bf a}^{\top} {\bf X} \, {\bf b} \right) = \mbox{tr} \left( {\bf b} {\bf a}^{\top} {\bf X} \right) = \left\langle {\bf a} {\bf b}^{\top}, {\bf X} \right\rangle$$
where the cyclic property of the trace was used and $\langle \cdot \,, \cdot \rangle$ denotes the Frobenius inner product. Since scalar field $f$ is linear in $\bf X$, its gradient is simply
$$\nabla f ( {\bf X} ) = \color{blue}{{\bf a} {\bf b}^{\top}}$$
matrix-calculus scalar-fields gradient