We use "mi dispiace" when we want to express sadness and/or empathy towards something that happened, but this something didn't depend on us, it's not our fault.
So, let's imagine this situation: you meet a friend at the supermarket, you ask her how she is and she tells you that she's sad because her boyfriend had an accident. To express sadness here you're gonna say "mi dispiace" (I'm sorry) because the accident was not your fault.
We use "mi scusi" (formal) or "scusa" (informal) when we want to say that we are sorry about something that depended on us, that we have done, it's our fault.
For example: if you quarrelled with a friend and it's your fault and you ask for forgiveness you're gonna tell her "scusa" (informal), whereas if you step on someone's foot in the subway you're gonna use "mi scusi" (formal), because it's someone you don't know.