Maritime Feedback No 20 includes details of an explosion on a yacht due to battery gas exploding and causing extensive damage. Similar explosions have started fires which have burnt boats to the waterline. Lead-acid batteries can give off a highly explosive hydrogen-oxygen mixture if they are over-charged, eg due to a regulator failing (that’s happened to me).
It should be more widely known that a standard gas detector will detect hydrogen well before the danger level is reached. If you are fitting a gas detector, consider fitting a dual head, with one head sited at the top of the compartment as hydrogen rises). Also consider fitting forced ventilation: a 12v computer fan, switched on when the batteries are charging (from the alternator or shore power) as it is easy to install and may save your life and your boat.