When the waves approach the shore, they start to get closer and closer to the sea floor slowing down because they now find friction at the bottom. This phenomenon leads the crests of the waves to become closer (their inter distance decreases). They crests start to increase in height as the waves compress each other and they keep coming at the same frequency.