This is mentioned in the book when Harry is preparing for the first task:
>"He felt a strange thrill as he slipped the badge onto his robes, and the heavy silver, embossed with the Triwizard Cup and the initials "H.P.", felt reassuringly solid against his chest. It had been made for him by Ollivanders, and even the inscription felt magical..."
So, while the magical aspects of the badges are never explained, we know Ollivanders crafted them, and the intricate details suggest a level of magical craftsmanship befitting a prestigious tournament.