Just from my perspective and from my program
most programs will definately know if you are applying to med-peds and one (or both) of the categoricals within the same institution. The program coordinators usually talk to one another, and at the ranking meeting, there are representatives from both medicine and pediatrics programs (in addition to people from med-peds)
In my experience (I've been to several ranking meetings now at my program), applying to both in the same program becomes an issue with Med-Peds. Most combined programs are small to begin with, and there is always that fear of attrition, that the program will lose a resident to the categorical side, creating a hole in the program (and future applicants will wonder why there are fewer residents in certain years). Then there's the question about how committed you are to the program, and why you should be ranked higher than someone who is commited to Med-Peds and less likely to switch to a categorical program.
During these ranking meetings - the fact that the applicant applied to both programs will be raised - but whether or not it dooms the application is based on the overall stats, what the interviewers thought of the applicants, what the committee members thought of the applicants, and what were the reasons for applying to multiple programs. For some people, it did not hurt them. For others, they went down on the rank list.
So there's no concrete answer. But if you apply to both programs (or all 3 programs) in the same institution, and you hope that no one will notice - then you missed your chance of explaining what your reasons were to the program(s). If someone notice this, it will definately hurt your chances.
Of course not all programs operate the same way. This is just one perspective from one program.