http://www.psychologytoday.com/blog/the-science-success/201101/the-trouble-bright-girls
The net result: when learning something new is truly difficult, girls take it as sign that they aren't "good" and "smart", and boys take it as a sign to pay attention and try harder.