The last day to register to vote for the Massachusetts Primary is Wednesday, January 16th. If you want to vote in the Primary, you MUST register by this date.
January 16th is also the last date to change your party affiliation if you want to vote in a different primary than the primary of the party you are already affiliated with. For instance, if you are registered as a Republican, but want to vote in the Democratic Primary, you must re-register either as Unenrolled or a Democrat. You can always change your party again after Election Day, but if you want to vote in a primary you must be registered as either a member of that party or as Unenrolled.
You can register to vote by mail with the form on the Boston Election Dept. website.
(info courtesy of MassVote)