The audience will particularly affect the choice of register; the level of formality of lexis and expressions.
Example
The target audience for a newspaper report will be much wider than a message left on someone's desk on a post-it note.
In the classroom
Analysis of who the target audience is when learners are planning writing can help develop awareness. Learners can also be shown how thinking about the target audience can improve the effectiveness of a piece of writing or speaking.
Further links:
https://www.teachingenglish.org.uk/article/teaching-exam-based-writing-skills