A mentality is a way of thinking or the ability to think and learn. If someone says you have the mentality of a kindergartener, that's great if you’re in kindergarten, but if you're in tenth grade, they're probably calling you immature.
An obvious part of the noun mentality is the word "mental," which means "of the mind." How your mind works is your mentality, either in a way that's measured in school or testing, or in the way you think about things. A learned way of thinking comes from experiences; for example you might have a competitive mentality at mealtime because you share a table with nine brothers and sisters.