They are simply covering up the mess.
But the behavior is also a way to mark territory.
All dogs have glands in their feet that secrete pheromones, and a couple of backward scratches into the earth releases those chemicals.
But if you're mad that your dog is destroying your grass, there is a solution.