The gerund is a form of the verb that can act as a noun. The gerund is formed with the ending -ing.
In this case the gerund is located after a preposition, and one of the rules of grammar tells us that after a preposition we can only use the gerund, never an infinitive verb.
The words the author chooses to use in a passage can change the whole tone and feeling of the story in many different ways, or add depth and detail to the story.