Based on my poor recollection, the basic way the file is laid out is this:
Each diplomatic action has a set of flavor texts.
Each flavor text entry can have a combination of situational qualifiers, such as "speaker more powerful", or "friendly with listener".
Each situation-specific action can be further subdivided by identifying the speaker or listener in particular. So you can say, "when speaking with Drengin and the Drengin are more powerful, say this". However, this requires you to be able to specifically identify the faction in question. This is easy with default races, but until now, was not easy with custom races because we could not include custom-race-specific text along with the race itself.
Each diplomatic action has at least one default text. Additional, apparently randomly selected, option can also be added so you don't get the same annoying line every time. Interestingly, most of the flavor text options in the file have only one entry (indicating a lack of time on the developer's part). There are a few additonal options spinkled in to flesh out some of the race relations lore of the game.
It would not take much for a modder to just add a ton of new variant options.