Answer
$grandfather(X,Y)$ :- $ father(X,Z),father(Z,Y);father(X,Z),mother(Z,Y)$
Work Step by Step
Here comma means AND and semicolon means OR. For $X$ to be grandfather of $Y$, either $Y$ must be the father of father of $X$ or father of mother of $X$.