The π bond of the carbonyl group can act as a base to a strong inorganic acid due to the distortion of the electrons from the electronegativity difference between the oxygen atom and the carbon atom and also the resonance dipole. The cation produced in the reaction with sulfuric acid will have resonance stabilization.
Mechanism for Acid Catalyzed Esterification
Step 1: Formation of cation
Step 2: The methanol can act as a nucleophile to a carbocation. Remember that there are many methanol molecules in the solution...it is always in excess in this reaction.
Step 3: The protonated ether can leave as methanol but that will not accomplish anything. A proton can be transferred to one of the hydroxyl groups and thus make it a good leaving group.
Step 4: The alcohol oxygen atom from the hydroxy group can donate a pair of electrons to the carbon atom making a π bond and eliminating water. The water will not be a viable nucleophile that will reverse the reaction because its concentration will be low compared to the concentration of the methanol.
Step 5: The water will be in too low a concentration to reverse the reaction.