You could try
FindInstance[{X^2 - Y^2 == M Z }, {X, Y, Z, M}, Integers, 3]
(*{{X -> 0, Y -> 301, Z -> -1, M -> 90601}, {X -> -139, Y -> -139,Z -> 1, M -> 0}, {X -> 8, Y -> 8, Z -> -37, M -> 0}}*)
The general solution can be calculated as follows:
Reduce[{x^2 - y^2 == m*z, Element[{x, y, m}, Integers] }, z, Integers]
(*(m | x | y | z) \[Element]Integers && ((m <= -1 && z == (x^2 - y^2)/m) || (m ==0 && (y == -Abs[x] || y == Abs[x])) || (m >= 1 &&z == (x^2 - y^2)/m))*)