Epigraphs are like little appetizers to the great entrée of a story. They illuminate important aspects of the story, and they get us headed in the right direction.
Truth, bitter truth–Danton
Stendhal opens Part One of The Red and the Black with this quote from Georges Danton, one of the leaders of the French Revolution.
Many historians think of him as the guy who overthrew the King of France and established modern democracy. The problem is that after the revolution was over, his buddies started executing everyone they thought was a political threat. Danton didn't think this was cool, and he was beheaded for his resistance. You can probably understand why Danton would think that "truth" was so bitter. He only found out too late that the "truth" of his situation was that people with power would do whatever it took to protect it.
The same is true for Julien Sorel, who is sentenced to death mostly because he stands up for his principles and criticizes France's most powerful citizens for being a bunch of superficial hypocrites. Truth (along with, um, shooting someone) is kind of what gets him executed. And there's nothing more bitter than that.
This epigraph is also probably Stendhal excusing himself early on in the novel for telling us such a grim tale. He was, after all, one of the forefathers of Realism (a genre that infamously pulls exactly zero punches) and he's alerting the reader that what they're about to read is truly bleak. This is kind of like if Stephen King used the epigraph "Abandon hope all ye who enter here" in one of his novels—he's letting the reader know that their reaction to the novel is totally what he had in mind.