As I understand you, you don't know anything about the entries in X Y or Z? Are you given any further information?
If Y is invertible, then you can right-multiply each side by the inverse of Y and then X will be similar to Z.
One solution: if Y is the zero matrix, the equation will always be true. If X = Z, then Y is the identity matrix, or some other matrix with which X commutes. The most general rule I know of is that two matrices will commute iff they are both diagonalizable to the same basis. Some 2x2 matrices, of course, are not diagonalizable at all.