They are called Cutie Marks—not hearts.
Each pony earns a unique Cutie Mark when they discover their special talent or purpose. The mark appears on both flanks and is central to the pony's identity (e.g., Twilight Sparkle's star, Rainbow Dash's lightning bolt, Applejack's apples).