In college computer science, most men are interested in computing (programming, tinkering, gaming, etc.) for its own sake, while many women are more interested in computing's effects on and applications in other fields and how it can be useful to society. The focus in many introductory CS classes on technical details makes some women disillusioned, and they drop out of CS, not realizing that it's not just about silly technical details.
Many men have wanted to study computer science since before they could remember, and think of it as a "no-brainer" to be a CS major; most women decided to study computer science in high school or college, and the choice was much more rational. Their reasons for choosing CS are much more broad than "enjoyment of computing," most men's primary reason.
Men are more likely to like programming for its own sake, and are more likely than women to spend endless hours programming outside of classes. When asked about their ideal computer, teenage boys described machines that give them super powers; teenage girls described machines that helped in tasks or offered companionship. One researcher notes that "the feminine take on technology looks right through the machine to its social function, while the masculine view is more likely to be focused on the machine itself." Many high-school and college kids erroneously see computer science as "number-crunching" and computer games as one of the main applications of computer science (when they have any conception at all of what computer science is); many high-school and college curricula support this misconception by focusing on banalities of programming languages and pointless programming exercises, especially in lower-division classes. (My experience with programming contest problems support this, perhaps explaining the dearth of women in such contests.)
Students in top-ranked programs like Carnegie Mellon's are very aware of the intense geek culture in such programs - of the expectation that they spend all their time in front of the computer, for work and play. (This is backed by some practices in industry such as providing bunk beds at work.) A well-rounded set of interests is undervalued and sometimes actively shunned in this culture. Women on average are more disturbed at this ideal, and how badly they fit it, than men. They are more likely to decide such an intense culture is not for them, and they drop out at a rate three or more times that of men.
Top-ranked programs are also so overzealous, in general, that novices, especially minorities, feel hopelessly behind. Between male "posturing" and lack of programming experience in high school and before, women feel that everyone catches on more quickly than they do and that they can never catch up, even though performance between women and men, in terms of grades, is nearly identical. Many also assume that such passion for computers is required to be a computer scientist, and if they don't have it, they should quit. They're also more likely to keep confusion to themselves because of comments like "what's your major, again?," or the threat of them.
(Some interesting trends in attrition: American women and women from wealthy families are more likely to drop out of CS, the former because many Americans credit intelligence to innate ability and not to hard work, and the latter because these women aren't as worried about having a good-paying job to support themselves or their families.)
Women also have to deal with "you're only here because you're female" talk that men never have to face. Expectations that women will not do as well may have a huge effect of performance, as shown by Claude Steele's experiments at Stanford (repeated elsewhere) that showed that an expectation of a gender difference on performance on a math test resulted in one, while an expectation of no gender difference resulted in near-equal scores. (There are similar results for race if participants are asked to note their race on the test.)
Admissions policies that value previous programming experience or high math SAT scores are biased against women. CMU found that prior programming experience does not affect success in the program, and others have found that math SATs "systematically underpredict" women's college performance (though it was the opposite for me, at least according to my GPA :~)).