The best weather for camping would be summer months, June to early August, as that is the warmest time of year. But it is also the most crowded, so finding a camping spot without advance bookings is nigh impossible.
If your camping equipment can handle colder weather, as in well below freezing (rated lower than -10 C, 15 F), then early fall, September and very beginning of October, is nice. Wyoming gets nice Indian Summers with sunny days, cold nights and not many storms in early fall (though there is usually a week with bad weather sometime during this period). The crowds are gone and wildlife more visible as it moves to the valleys.
The park closes 31 October until about mid-December, then re-opens for winter season until about mid-March. Winter camping is permitted, but you really need to have some experience (and proper snow camping gear) with this as temperatures can get quite cold and developed campgrounds per se do not exist.
The park first opens in mid-spring, but weather can be wet and cold so not really a good time for camping.