Some times the level of inflammation isn't visible to the naked eye but there is inflammation present just at the cellular level, hence picked up by the pathologist during biopsy.
My son has CD, not UC. At diagnosis, his inflammation was severe and chronic and visible during scope. At various other times, after starting a med, after surgery, he has had scopes that looked pristine but the disease was still active at the cellular level as seen by biopsy.
There is also another form of IBD, microscopic colitis, that can't be seen with a scope. There are two types of microscopic colitis collegenous colitis and lymphocytic colitis. In most cases, it's less severe than other forms of IBD.