Gravitational attraction is inversely proportional to the square of the distance from the source. The attraction will be stronger on the side of a body facing the source, and weaker on the side away from the source. The tidal force is proportional to the difference.