A boggart is a non-being that can shapeshift into someone or something of the worst fear of its viewer. Most people in the wizardry community face a Voldemort boggart as he is the scariest person for them. But it is different for Hermione. When she encountered a boggart she saw Professor McGonagall gave her a failing mark.
Seeing your worst fear can make you startle and lose your composure to counterattack. In order not to be swallowed by your fear, it is advised that you have someone else along to help you realize that it is not a reality. They can help a person affected by a boggart to return to their senses and fight it off.