There is a difference between the two but in most everyday conversations they are used interchangeably.
The word "bebakhsheed" ببخشید comes from the verb "bakhshesh" بخشش which means: to give freely, forgiveness etc. It is the equivalent to: Forgive me in English.
The phrase "maazerat mikhaham" معذرت میخواهم comes from the word "oozr" عذر which means: excuse. It is equivalent to: Excuse me in English.
In most everyday situations they are used interchangeably when interrupting someone. So I can say: ببخشید (Forgive me) or معذرت میخواهم (Excuse me) when stopping someone to ask for something.
Both are very similar to their equivalents in English but again there are differences. For example in English when showing astonishment one can says in a loud and/or sarcastic manner: Excuse me! which would translate to "maazerat mikhaham" معذرت میخواهم but this is not used in Farsi, instead in Farsi to show astonishment the word "bebakhsheed!" !ببخشید is used with the same loud and/or sarcastic tone.