For the most part, Dignam's role in this movie is to talk as much smack as possible and make things hard for everyone around him. He's almost a parody of the typical grumpy cop stereotype you find in most cop movies. For example, his response to hearing Billy Costigan quote Nathaniel Hawthorne is to say:
DIGNAM: What's the matter, smart-ass, you don't know any f***ing Shakespeare?
Need we remind you that this is the first time Dignam has ever met Billy? We can infer that he's not one to care about first impressions.
Dignam goes right for the throat when he calls Billy out on growing up in rich and poor neighborhoods by saying:
DIGNAM: You have different accents? You did, didn't you, you little f***ing snake? You were like different people.
Now, what's going on here is that Dignam, who really did grow up in Southie, is taking Billy down a notch. But it's also more complicated than that. Dignam's also showing that Billy, who is good at being different people in different situations, might be an ideal undercover cop.
Despite his rough exterior, Dignam is fiercely loyal to his boss, Captain Queenan. When he finds out that Queenan got killed while Sergeant Sullivan's people were following him, he punches Sullivan in the face and is told to take a leave of absence. But Dignam doesn't even hesitate to say:
DIGNAM: I'd rather hand in my papers first.
So there you have it. Dignam quits his job because he'll never be able to stand working alongside a guy that he (rightfully) blames for his captain's death.
On top of being a rough dude, Dignam is also very good at protecting his undercover cops. When asked by the FBI if he has anyone in Costello's inner circle, Dignam charmingly answers:
DIGNAM: Maybe. Maybe not. Maybe f*** yourself. My theory on Feds is they're like mushrooms. Feed them s*** and keep them in the dark.
While it's clever and funny, this line also shows that Dignam doesn't care about anything in the world except protecting his Special Investigations Unit and the undercover cops who work in it.
Finally, we find out at the end of the movie that Dignam isn't afraid to take the law into his own hands. After Billy dies, Dignam basically says "to heck with it" and murders Colin Sullivan. He doesn't know for sure that Colin is responsible, but he has enough of a hunch to dress up in plastic and kill the guy in the final scene of the movie.
You might even say that in the end, Dignam is the only main character who walks away from the destruction of this movie, since everyone else involved in the Costello bust ends up getting shot and killed. So maybe the best label you can give to a guy like Dignam is "Last Man Standing."