Controlling Fano resonances in multilayer dielectric gratings towards optical bistable devices