Sometime between years 2 and 3, children gain the ability to evaluate their own behavior against a standard. As children learn about the expectations other people have of them, they gain a better sense of the rules and standards of their family and culture. These standards, rules, or goals often come from parents, caregivers, and teachers, but children also develop their own standards against which they evaluate their own behavior. Once children can compare their behavior against a standard, new emotions like shame, guilt, and pride arise.
References:
Lewis, M. (2000). The emergence of human emotions. In Lewis, M., & Haviland-Jones, J. M. (Eds.), Handbook of emotions (2nd ed.). New York: Guilford Press.