A rate "lock" or "commitment" is a promise from the lender to set a particular interest rate and a specific number of points for you for a certain period during your application process. This protects you from getting through your entire application process and finding out at the end that your interest rate has gone up.
While there are several lengths of rate lock periods (from 15 to 60 days), the longer spans are usually more expensive. You can get a longer period for your lock, but in doing so, will most likely have a higher rate than you would with a shorter rate lock span of time
There are other ways to get a better rate, in addition to going with a shorter rate lock period. The bigger down payment you pay, the better your rate will be, because you will have more equity from the beginning. You can pay points to bring down your interest rate for the term of the loan, meaning you pay more up front. One strategy that makes financial sense for many people is to pay points to improve the rate over the life of the loan. You'll pay more up front, but you'll come out ahead in the end.
Do you have a question regarding a mortgage program?