Keeping a stiff upper lip can be hard to do and that's why it became an expression. When someone gets upset, his or her lips might tremble. If you keep a stiff upper lip, you're trying not to show you are upset. This expression dates back to the 1800s, but it is still used today.
"Keep your chin up" has a similar meaning. When someone is sad or depressed, the person might drop his or her head, bringing the chin down toward the chest. A chin held high shows confidence and optimism. So the next time you get a lower grade than you expected, keep your chin up and try to do better next time!