Bankruptcy will not affect the terms of the mortgage. A Chapter 13 Bankruptcy can put the delinquent mortgage payments in a repayment plan over the course of 3 to 5 years. However, you must continue to pay the monthly mortgage payment as they become due. Bankruptcy will not force the lender to reduce the interest rates, increase the duration of the loan, or reduce the principal loan balance. There are a minor exception, such as a Chapter 13 Bankruptcy can remove and eliminate the second deed of trust or home equity line of credit called "lienstripping" or "lienstrip" if you qualify.
Bankruptcy law is changing and you should consult an experienced bankruptcy attorney on how bankruptcy can benefit you.