Semantic foundations for generalized rewrite theories