I think it's both the bacteria thing – getting rid of them before they can start metablizing your food into stuff to harm your enamel – and the idea that directly following food intake, your mouth pH level will be out of homeostasis and enamel may be easier to erode at "non-native" pHs and one shouldn't brush directly after. I'm not sure where I got that from though.