Carol Dweck's research on growth and fixed mindsets is the ground under this one. Praising the work a child put in, rather than the outcome, teaches that ability is something a person can build. There is an asterisk in the title for a reason. Praising effort attached to a strategy that is failing only prolongs the failure, and children who succeed easily still need to hear something specific about what they controlled.
This is the short version. The full lesson, with the story behind it, is in the book.
Take The Summer Camp MBA with you, or get the field notes by email while you work through the lessons here.