An attack on a Melbourne synagogue that left the building in flames has been labelled a terrorist attack.