Dogberry is a fairly minor character within the grand scheme of the play, but he serves as a foil in both of the major plots. As Borachio points out, it’s Dogberry and his idiots who figure out Don John’s manipulation, rather than the "smarter" characters – Don Pedro, Leonato, Antonio, and Claudio.
Dogberry also is a foil to Benedick and Beatrice. He alone in the play uses language as passionately as those two characters. His usage of the English language is also equally startling as theirs, but where they use language to elevate and scintillate, Dogberry just abuses it.