Why does lightning hit a plane when it's not grounded?
Lightning is caused by the rapid and very high current discharge between one charged cloud and another or to ground. The metal skin and structure of an airplane provides a lower resistance path than the surrounding air. It is the preferred path.


  Is it something to do with batteries on a plane?


No. The plane acts as a Faraday cage and the skin protects the on-board electrics to a large extent.


  Why does lighting hit a plane when it's not grounded?


It doesn't have to be grounded. It just has to be close to the path of the lightning.