When you opt for a mortgage or any other kind of secured loans your lender will check your debt to income ratio with your credit score before approving the loan. Debt to income ratio shows that how strong a borrower is financially. Debt to income ratio is your total expense towards all of your debts (includes monthly mortgage payments, credit card bills, student loans, car loans etc) compared to your gross monthly income. But you should not include your expenses to your foods, electricity bills, gas, restaurant bills, entertainment etc to it.
Debt to income ratio is not as important as the credit score for getting a loan but it plays a strong role for getting approved for a loan. It gives true light on your current financial condition and that helps the lender to understand how strong you are financially. So if you have a better DTI then getting approved for a loan will be much easier.
The lender want to see the DTI because the borrower may earn a lot of money but if his debt is too high and his debts match to his income then this is a big problem for him. The lower the ratio is the better for the borrower. That means if you have lower debts and your income is high then you can get the loan with better rates and terms. Generally it is considered that your DTI should be below 36 percent. But if it is more than 36 percent then also the lender may approve you for the loan but will charge you more.
Remember that debt to income ratio is not the only thing that the lender will consider; there are other things like your credit score, length of time of you current job etc will also play an important role but having a better DTI will certainly give you advantage for getting approve for the loan.