Coastal communities across northern Scotland will benefit from millions of pounds in funding to enhance their local areas.