As with many things in law, the answer is “it depends.”
The goal of mediation in a divorce is ultimately to create a binding legal agreement without going to court. However, anything that you agree to or say during a mediation that does not ultimately end in settlement cannot be used if you later proceed to trial. In contrast, things that you say during trial can be binding and can be used as evidence in future matters that are going through the family court system, as matters tried in family court become part of the public record.
Therefore, the ultimate agreement that is born out of mediation can be legally binding, but the things that are said during the course of mediation are not as legally binding as statements made in the course of litigation.