A 16-year-old boy is accused of plotting a terror attack on local synagogues, a court hears.