Bgriff has the right idea but the timelines are a little off, but great response!
If you include your property in BK and mark the box "Surrender" you can still remain in the home and make payments. If your property ultimately forecloses it will go by the bankruptcy seasoning period rather than foreclosure however you would want to show your intent right after the bankruptcy and that would be missing payments if you're really planning on surrendering it. Bankruptcy seasoning periods are 4 years for Chapter 7 BK for Conventional loans.
FHA considers bankruptcy and foreclosure 2 separate events, if the property forecloses the foreclosure timeline would start ticking once the deed is out of your name (not when you were discharged from bankruptcy).
If you mark the box "Retained" and continue to make payments, that obviously means you want to keep the home. If you owe more than the home is worth it may be best to mark the box Surrender but again with a new (purchase) loan - if you stay and pay the new lender will look at the transaction history and deny a new loan based on the fact that you really were planning on "keeping the home" and maybe did a strategic default after.
Hopefully this provides some insight, if you have any more questions don't hesitate to ask.