Two squares out of 64 can be selected in 64C2=264×63=32×63 ways
The number of ways of selecting those pairs which have a side in common =(21) (4×2+24×3+36×4)=112
[Since each of the corner squares has two neighbours each of 24 squares in border other than corner ones has three neighbours and each of the remaining 36 squares have four neighours and in this computation, each pair of squares has been counted twice].
Hence required probability =32×63112=181