Solution:
Let ci,j denote the cell in the i-th row from the bottom and the j-th column from the left, so Sam starts at c1,1 and is traveling to c5,5. The key observation (from, say, trying small cases) is that
Claim. For 1≤i,j<5, the cells ci+1,j and ci,j+1 must be the same color.
Proof. Choose a path P from c1,1 to ci,j, and a path Q from ci+1,j+1 to c5,5. Then consider the two paths P→ci+1,j→Q and P→ci,j+1→Q. These both must have 3 cells of each color, but they only differ at cells ci+1,j and ci,j+1. So these cells must be the same color.
Hence, every diagonal Dk={ca,b:a+b=k} must consist of cells of the same color. Moreover, any path that goes from c1,1 to c5,5 contains exactly one cell in Dk for k=2,3,…,10. So we simply need to color the diagonals D2,…,D10 such that there are 3 diagonals of each color. The number of ways to do this is (3,3,39)=1680.