Your question seems to point towards a very interesting aspect of Shakespeare's comedies: the way in which there seems to be a very thin dividing line between a "comedy" and a "tragedy." You might like to view the question from the following perspective: what would you need to change to make this play a tragedy? Certainly, all the elements are there. You have an evil brother determined to get revenge and destroy the chance of happiness that other characters have. After the scene when Claudio confronts Hero about her supposed infidelity, it almost seems as if Don John has won and evil will prevail, especially when Leonato threatens to disown his daughter.
However, what keeps this play on the path of the comedy is the sustained comic tone that runs throughout, apart from the more serious scenes. The rivalry and gulling of Beatrice and Benedick are hilarious and immensely amusing. This and the way that, in spite of appearances, the play results in a satisfyingly happy ending, ensures that the comedy carries us through the darker moments of the play as we move towards the typical ending of a Shakespearian comedy, involving unions and marriages and the exiling of the evil elements in the play.