Changes in your mentality settings can influence the mentality of your formation. Some formations are naturally more offensive or defensive than others. A 5-4-1 formation for example is naturally more defensive than a 3-4-3 formation. However, you can tune the mentality of the formation even more by adjusting the overall mentality of the formation.

The better (you think) your team is compared to your opponent the more offensive you should play. You should play more defensively if you think you are up against a superior opponent.

A simple example: Superior FC vs Rock Bottom Utd 
Defensive game - Chances home/away: 10 / 4 
Offensive game - Chances home/away: 20 / 8 

Superior FC gets 10 chances more when the game is offensive, while Rock Bottom Utd only gets 4 more. This more offensive game will of course suit Superior FC more than it will Rock Bottom Utd.

Important Note!
Playing "all-out attack" will create a lot of chances but it will also leave your defense vulnerable to any attacks your opponent will have. So only use this mentality when you are behind and want to risk it all late in matches. Otherwise you will risk all chances against you will be lethal.