It's often mentioned that foods can be programmed into the replicator, but never (to my knowledge) with details as to how that programming takes place. In addition to @Valorum's quote, there's an instance in "Lessons" where Nella programs several varieties of tea into the replicator.
NELLA: Earl Grey? No wonder you can't sleep. Computer, bring replicators back online and give me a cup of Daren herbal tea blend number three, hot. You shouldn't be drinking a stimulant at this time of night. I think you'll like this.
...
NELLA: I've programmed seven other blends into the replicator. You're bound to like one of them.
PICARD: I look forward to sampling them.
The Next Generation Transcripts - Episode Listings, "Lessons"
We do, however, have some idea how holographic programs are made. Were we to enter the realm of conjecture, we might note that:
Holographic programs could be stored on holodeck databases. ... These databases often contained many stock elements that could be called up by a user to design new holographic programs, such as particular eating establishments, famous cities, and characters.
Holographic Program - Memory Alpha
We also see characters creating and modifying holodeck programs through verbal interaction:
JANEWAY: Computer, display Fair Haven character Michael Sullivan. Adjust his parameters to the following specifications. Give him the education of a nineteenth century third year student at Trinity College.
COMPUTER: Modification complete.
JANEWAY: Now, access the character's interactive subroutines. Make him more provocative.
COMPUTER: Specify.
JANEWAY: Give him a more complicated personality.
COMPUTER: Specify.
JANEWAY: More outspoken, more confident, not so reserved. And make him more curious about the world around him.
COMPUTER: Modification complete.
JANEWAY: Good. Now, increase the character's height by three centimetres. Remove the facial hair. No, no, I don't like that. Put some back. About two days' growth. Better. Oh, one more thing. Access his interpersonal subroutines. Familial characters. Delete the wife.
COMPUTER: Modification complete.
JANEWAY: Pleased to meet you, Mister Sullivan.
The Voyager Transcripts - Fair Haven, Fair Haven clip on YouTube
We might then extrapolate that replicators function similarly - they have a database of known foods and food components, and new dishes can be created by incorporating and modifying those existing elements via Star Trek's highly sophisticated verbal interface. Which is essentially what @Valorum said.