An idiom is a combination of words with a meaning that is different from the meanings of the individual words. It can have a literal meaning (the basic meaning of the words) or an idiomatic meaning (a different meaning than the exact meaning of the words). It is a phrase which does not always follow the normal rules of meaning and grammar. To sit on the fence can literally mean that one is sitting on a fence.
I sat on the fence and watched the game.
However, the idiomatic meaning of to sit on the fence is to not clearly choose a side regarding some issue.
The politician sat on the fence and would not clearly state his opinion about the issue.
Many English idioms are similar to expressions in other languages and can be easy for a learner to understand. Other idioms come from older phrases which have changed over time. To hold one's horses means to stop and wait patiently for someone or something. It comes from a time when people rode horses and would have to hold their horses while waiting for someone or something. "Hold your horses," the man said when his friend started to leave the store.
Other idioms come from such things as sports and may require some special cultural knowledge to understand them. To cover all of one's bases means to thoroughly prepare for or deal with a situation. It comes from the American game of baseball where you must cover or protect the bases.
I tried to cover all of my bases as I prepared for the job interview.
Most idioms are fixed in their grammatical structure. The expression to sit on the fence cannot become to sit on a fence or to sit on the fences.
Other idioms are the result of a change in grammatical structure and would generally be considered to be incorrect. To be broken literally means that something is broken.
The lamp is broken so I cannot read my book. To be broke is grammatically incorrect but it has the idiomatic meaning of to have no money.
I am broke and I cannot go to a movie tonight.
There can also be changes in nouns, pronouns or in the verb tenses.
I sat on the fence and did not give my opinion. Many people are sitting on the fence and have not made a decision.
Adjectives and adverbs can also be added to an idiomatic phrase.
The politician has been sitting squarely in the middle of the fence since the election.
That is why it is sometimes difficult to isolate the actual idiomatic expression and then find it in a dictionary of idioms.