A 70-year-old man has been charged with a terrorism offence over online comments about Hamas.