Republican Gov. Charlie Baker said Tuesday the funds will be parceled out to more than a dozen local communities and research organizations.
Baker says the Shannon grants support education and employment opportunities for at-risk youth who might otherwise become involved in gangs.
The grants are named for the late Charles Shannon, a police officer who later served as a state senator.
Boston received a grant for more than $1.1 million that Police Commissioner William Evans says will have an impact on gang violence in the city.
Other cities receiving funding include Brockton, Fall River, Fitchburg, Haverhill, Holyoke, Lawrence, Lowell, Lynn, New Bedford, Pittsfield, Springfield and Taunton.