What do you mean, an "illegal" reason?

You couldn’t, for example, say that child support shall cease if your children celebrate Halloween while in your soon-to-be-ex-wife’s care. Child support is required and cannot be stopped. Also, you couldn’t agree to a property settlement requiring either you or your wife to do a dangerous or illegal action as a condition to receiving the property.

Be aware, also, that some states do not allow a separation agreement concerning child custody. Other states do not allow a waiver of child support in favor of a lump sum. Your lawyer must be careful to check your states laws regarding what is "permissible" in a separation agreement.

A separation agreement is a contract and must meet basic contract rules and requirements or the court will not accept it.