Voice is part of grammar because it pertains to how the action, or state, of a verb relates to its subjects and objects. There are two types of voices: active and passive.
Active voice is when the subject comes before the verb in a sentence and, consequently, is performing the action. For example: David makes mistakes. Here, David is the subject, the verb to make is the action, and the word mistakes is the object. Because the active voice maintains sentence clarity, it is often used in most non-scientific writing. For example, it is considered ideal in fiction because it is clear and concise and allows creative ideas to be conveyed more efficiently.
Passive voice is when the subject is becomes the target and the object of the sentence becomes the doer, which can make things a little bit weaker. For example: Mistakes are made by David. Here, the subject is mistakes, the action is making, and the object is David even though David is performing the action.
An important thing to note that is that the verb to be is not always a sign of passive voice. Some people argue that it in fact is, but I’d like to draw your attention to one example: Phoebe the bulldog is annoying Lucy. This sentence is very much in the active voice. Its passive voice counterpart would be the following: Lucy is being annoyed by Phoebe the bulldog.
Passive voice is often considered a bad thing because it can be difficult to understand. Often, the meaning gets convoluted because sentences in the passive tense tend to be much more wordy. It can result in awkward, stumbling sentences or sentences that are much too broad and vague.
That being said, passive voice is not always incorrect. It can be useful in fiction writing, particularly when writing mysteries, because sometimes you don't want the reader to be aware of the subject. For example, you might write: The gold was stolen instead of Cora stole the gold. Passive voice is thus a very good technique to make use of when you want to preserve an essence of mystery. That is why, in some cases, writers might avoid the passive voice, like in history analyses or papers.
However, passive voice has applications in non-fiction as well. Many politicians and big companies use the passive voice to redirect attention from the subject of the action. For example, a business might say, “Your water will be shut off” because that sounds better than “We (the company) are shutting off your water.” A more honest use of the passive voice can be found in scientific papers, where the passive voice is used to help reduce bias.
So, when in doubt or if you're unsure how to phrase sentences in your upcoming novel or short story or piece of flash fiction, you can settle on using the active voice. It's a voice that is known for being more efficient and garnering more success among fiction writers. It keeps your character at the centre of attention, which is usually what you're aiming for in creative writing. However, the use of passive voice should not be totally shunned. There are times when the passive voice is useful: at points, it adds variety to a creative work or can evoke an air of mystery. It is also great voice to employ in situations where bias should be limited. Ultimately, it is up to you to choose which voice best expresses what you wish to convey.