There is an RFC, but in practice the format is super informally specified. You'll encounter
# comments
// comments
<!-- comments -->
/* comments */
plain text lines as comments
TeX-markup
script tags
HTML
PHP code
Whatever this is: https://www.costablancaworld.com/robots.txt
search-engine specific directives (Yandex has a few strange ones)