It isn’t because they actually know the material better, but because they don’t annoy the teacher:
Despite having higher scores on standardized tests, boys get lower
grades than girls. Why? Because teachers are basing grades at least
partly on classroom behavior, and the standards are very much geared to
female norms….“Boys in all racial categories across all subject areas are not
represented in grade distributions where their test scores would
predict. Even those boys who perform equally as well as girls on
reading, math and science tests are nevertheless graded less favorably
by their teachers.”
In summary, girls are able to substitute apple-polishing and classroom etiquette for an amount of knowing the material, and they are being rewarded for it, beginning in kindergarten. Their better grades are eventually used to give them priority of place in college, thereby leading observers to erroneously conclude that they are “outperforming” men.
Unsurprisingly, the boys who are smart enough to figure out the deck is stacked against them lose all respect for the system and opt out in varying degrees.