A fable is a very small "tale" (written as prose—straight writing—or verse, also called poetry) which includes:
In Aesop's Fable, "The Fox and the Grapes," we see that the fox had admirable determination, using all his strength to reach the grapes that are growing just too far out of his reach. Finally, frustration gets the best of the fox and he quits, but as he does so, he shows what a poor sport he is. Like a small child, he tries to rationalize that not getting the grapes wasn't such a big deal because they weren't worth having in the first place.
Rather than facing the fact that he just wasn't able to get the grapes, the fox acts as if the grapes were always unimportant, taking his failure out of the picture. The comment about being "sour grapes" describes someone that has nothing positive to say about a situation, but chooses to criticize it. The expression "sour grapes" finds its origins in...
..."The Fox and the Grapes"... It refers to pretending not to care for something one does not or cannot have.
Phaedrus summarizes the fable's moral as:
People who speak disparagingly of things that they cannot attain would do well to apply this story to themselves.
The fox's poor sportsmanship, or his inability to "win" what he wants and then criticizes the very thing he wanted are characteristics that fit with the practice of some people who have nothing good to say about something if it doesn't reflect well on them. The moral of the story is directed at those people who criticize what they cannot get or do, diverting attention away from themselves, which is what the fox does.