In the bottle of a M17 medium they recommend to autoclave the medium without lactose, wait cool down to 50 °C and add (filter sterilized) lactose (or glucose).
The medium (37.25 g) is composed by:
Pancreatic Digest of Casein 5.0 g
Soy Peptone 5.0 g
Beef Extract 5.0 g
Yeast Extract 2.5 g
Ascorbic Acid 0.5 g
Magnesium Sulfate 0.25 g
Disodium-β-glycerophosphate 19.0 g
I thought it maybe because of Maillard reaction. However if this is the case waiting to cool down at 80 °C should be already fine.