I don't think there is a science to that. If you look at the SOP for 16S bioinformatic analysis using Mothur, for example, they use 1 mismatch for barcodes and 2 for primers. I personally use 1 for each.
I've gotten used to running a control mock community along with all my samples and this allows me to trust the sequencing results I am getting.