Full definition of .cabal file syntax
Is this what you want?
Distribution.PackageDiscription
a proper grammar definition for the .cabal file format.
The grammar is defined by its parser. I don't know of a formal specification.
The list of the fields, whether they are required or not, and what goes in them is here https://www.haskell.org/cabal/users-guide/developing-packages.html#package-properties.
Not the most obvious of places, I must admit.