I mean, in the following choices :-
Before/After Beating Elite 4 Before/After beating _____ Gym, and so on..
Before the E4 in the Giant Chasm:
http://bulbapedia.bulbagarden.net/wiki/TM13
Before the Elite Four in the Giant Chasm. Requires Surf. And it is after you beat the Humilau City Gym.
Source: I gave it to my Genesect before the Elite Four.