When you are looking to purchase a home, you will talk to a lender about a comfortable budget and how much you can spend when you purchase a home. That is based on the interest rate at the time you apply for the loan and as time progresses, the rate may change as you are searching for a home.
Once you have an accepted contract, you will then have the option to lock in the rate. If you choose to not lock in right away, you can float the rate, which means it stays at market. If the market goes up, then the rate goes up, if the market goes down, then the rate goes down.... so there is a bit of a risk.
Most times, once you have the opportunity to lock and you are comfortable with that rate and payment, you should lock in so there are no surprises. I would be terrible if you were to float it and then find out the rates went up reducing your purchasing power and then lose the house.
Naturally, the lender you are working with will explain all of this too you and keep you informed so you can make the best decision when the time comes.